const Joi = require("joi");

// 定义对象的验证规则
const userSchema = {
  username: Joi.string().min(6).max(12).required().alphanum().error(new Error('ihfjkdhkhkjyyi能否快速搭建')),
};

async function test() {
  try {
    await Joi.validate({ username: "321" }, userSchema);
  } catch (error) {
    console.log(error);
  }
}

test();
